using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DAL
{
    public partial class MainForm : Form
    {
        ListBoxText lt;
        BLU_DBDataSetTableAdapters.AddressBookTableAdapter addressBookTableAdapter = new DAL.BLU_DBDataSetTableAdapters.AddressBookTableAdapter();
        private int i;


        public MainForm()
        {
            InitializeComponent();
            lt = new ListBoxText();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'bLU_DB_dsAddressBook.AddressBook' table. You can move, or remove it, as needed.
            this.addressBookTableAdapter.Fill(this.bLU_DB_dsAddressBook.AddressBook);
        }

        private void MainForm_Activated(object sender, EventArgs e)
        {
            i = 1;
            // Get lastest snapshot of the database
            this.addressBookTableAdapter.Fill(this.bLU_DB_dsAddressBook.AddressBook);
        }

        private void MainForm_Deactivated(object sender, EventArgs e)
        {
            i = 2;
        }

        private void btnHide_Click(object sender, EventArgs e)
        {
            this.Hide();

            timer1.Enabled = true;
        }

        private void Timer_OnTick(object sender, EventArgs e)
        {
            this.Show();
            timer1.Enabled = false;
        }

        private void buttonInsert1000_Click(object sender, EventArgs e)
        {
            for (int i = 1; i <= 10; i++)
            {
                try
                {
                    this.addressBookTableAdapter.Insert(i, i, i, "a", "john", "jgnazzo@gmail.com");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace);
                }
            }
        }

        private void btnScreenGrab_Click(object sender, EventArgs e)
        {
            DAL.ScreenGrabber.Snapshot("test.bmp",new Rectangle(0,0,800,480));
        }

        private void btnShowListBox_Click(object sender, EventArgs e)
        {
            lt.ShowDialog();
        }
    }
}